package com.ssy.lingxi.platform.template.service.entity.adorn;

import com.ssy.lingxi.platform.template.service.handler.convert.JpaJsonToJsonObjectConverter;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.HashMap;
import java.util.Map;

/**
 * APP装修（B端企业商城，C端企业商城，自营商城，品类导航页，会员店铺，渠道商城） - DO
 * @author fhj
 * @date 2021/07/22
 * @version 2.0.0
 */
@Data
@Entity
@Table(schema = "public", name = "pt_app_adorn")
public class AppAdorn {

    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="app_adorn_seq")
    @SequenceGenerator(sequenceName="pt_app_adorn_seq", name="app_adorn_seq", allocationSize = 1)
    @ApiModelProperty(value = "ID")
    private Long id;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "模板ID")
    private Long templateId;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "会员ID")
    private Long memberId;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "角色ID")
    private Long roleId;

    @Convert(converter = JpaJsonToJsonObjectConverter.class)
    @Column(columnDefinition="jsonb")
    @ApiModelProperty(value = "装修内容")
    private Map<String, Object> adornContent = new HashMap<>();

    @Convert(converter = JpaJsonToJsonObjectConverter.class)
    @Column(columnDefinition="jsonb")
    @ApiModelProperty(value = "品类导航页装修内容")
    private Map<String, Object> categoryAdornContent = new HashMap<>();

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "创建时间")
    private Long createTime = System.currentTimeMillis();
}
